package com.lsy.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.lsy.entity.Invest;
import com.lsy.entity.InvestCustom;
import com.lsy.mapper.interf.InvestMapper;
import com.lsy.service.interf.InvestService;

@Service
@Transactional(readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class InvestServiceImpl implements InvestService {

	@Autowired
	private InvestMapper investMapper;

	public boolean save(Invest object) throws RuntimeException {
		boolean result = false;
		if (investMapper.insert(object) > 0) {
			result = true;
		}
		return result;
	}

	public boolean deleteById(int investId) throws Exception {
		boolean result = false;
		if (investMapper.deleteByPrimaryKey(investId) > 0) {
			result = true;
		}
		return result;
	}

	public List<InvestCustom> findList() throws Exception {
		return investMapper.findList();
	}

	public InvestCustom findInvest(int id) throws Exception {
		return investMapper.selectById(id);
	}

}
